package com.linln.modules.store.repository;

import org.springframework.data.jpa.repository.Query;

import com.linln.common.constant.StatusConst;
import com.linln.modules.store.domain.Type;
import com.linln.modules.system.repository.BaseRepository;

import java.util.List;

/**
 * @author hct
 * @date 2019/09/12
 */
public interface TypeRepository extends BaseRepository<Type, Long> {
	
	/**
     * 获取排序最大值
     * @param pid 父部门ID
     * @return 最大值
     */
    @Query("select max(num) from Type m where m.pid = ?1 and m.status <> " + StatusConst.DELETE)
    public Integer findNumMax(long pid);

    @Query("SELECT id,title FROM Type")
    public List<Type> selectTypeList();

}